package com.xuexiang.xuidemo.app.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.imageview.ImageLoader;
import com.xuexiang.xui.widget.imageview.RadiusImageView;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.base.BaseFragment;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link TestingImg#newInstance} factory method to
 * create an instance of this fragment.
 */
public class TestingImg extends BaseFragment {

    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "imgUrl";

    private String mImgUrl;
    private RadiusImageView imageView;

    public TestingImg() {
        // Required empty public constructor
    }

    public static TestingImg newInstance(String imgUrl) {
        TestingImg fragment = new TestingImg();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, imgUrl);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mImgUrl = getArguments().getString(ARG_PARAM1);
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.app_fragment_testing_img;
    }

    @Override
    protected void initViews() {
        imageView = findViewById(R.id.word_image);
        ImageLoader.get().loadImage(imageView, mImgUrl);
    }

    @Override
    protected TitleBar initTitle() {
        return null;
    }
}